import React,{Component} from "react";
import './list.scss'
class List extends Component {

   del=(index)=>{
       let list = this.props.list
       list.splice(index,1)
       this.setState({
        list:this.props.list
       })
   }

  render() { 
    return (
      <div className="combottom">
        <ul>
          {
            this.props.list.map((item,index)=> 
                <li key={index} className="li">
                  <div className="div">
                    <h2 className="h2">评论人：{item.title}</h2>
                    <span className="p">评论内容：{item.content}</span>
                  </div>
                  <span onClick={this.del}>X</span>
                </li>
            )
          }
        </ul>
      </div>
    );
  }
}
 
export default List;